<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta content="B2B电商平台" name="description" />
<meta content="B2B电商平台" name="keyword" />

<title>B2B电商平台.店铺商品变价申请</title>
<link rel="icon" href="include/images/icss.ico" type="image/x-icon" />
<link rel="shortcut icon" href="include/images/icss.ico"
	type="image/x-icon" />
<link rel="stylesheet" type="text/css"	href="<%=path %>/include/css/global.css" />
<link rel="stylesheet" type="text/css"	href="<%=path %>/include/css/style.css" />
<link rel="stylesheet" type="text/css"	href="<%=path %>/include/css/pro.css" />
<link rel="stylesheet" type="text/css"	href="<%=path %>/include/css/proManage.css" />
<link rel="stylesheet"	href="<%=path %>/include/JQuery ui/css/smoothness/jquery-ui-1.7.3.custom.css"	type="text/css"></link>
<link rel="stylesheet" type="text/css"	href="<%=path%>/include/pagination/page.css" media="all">
<link rel="stylesheet" type="text/css"	href="<%=path %>/include/sweetalert/sweetalert.css" />
<link rel="stylesheet" type="text/css"	href="<%=path %>/include/css/mmt_trading.css" />
<link rel="stylesheet"	href="<%=path %>/include/layer/skin/default/layer.css" type="text/css"></link>

<script type="text/javascript"	src="<%=path %>/include/js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/cookies.js"></script>
<script type="text/javascript" src="<%=path %>/include/js/icss.busin.js"></script>
<script type="text/javascript"	src="<%=path %>/include/JQuery ui/js/jquery-ui-1.7.3.custom.min.js"></script>
<script type="text/javascript"	src="<%=path %>/include/js/icss.common.js"></script>
<script type="text/javascript"	src="<%=path%>/include/pagination/jquery.pagination.js"></script>
<script type="text/javascript"	src="<%=path%>/include/pagination/init.js"></script>
<script type="text/javascript" src="<%=path %>/include/layer/layer.js"></script>
<script type="text/javascript"	src="<%=path %>/include/sweetalert/sweetalert.min.js"></script>
<script type="text/javascript"	src="<%=path %>/include/sweetalert/sweetalert-dev.js"></script>
<link href="<%=path %>/include/DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css">
<script src="<%=path %>/include/DatePicker/WdatePicker.js" charset="UTF-8" type="text/javascript"></script>


<style type="text/css">
.price a.price_rise {
	background-position: -62px -134px;
}

.price a.price_drop {
	background-position: -62px -93px;
}

.price a.price_null {
	background-position: -62px -15px;
	padding-right: 0px;
}

.price {
	margin: 0px auto;
}

.expire {
	margin: 0px auto;
}

.expire a.expire_drops {
	background-position: -61px -93px;
}

.expire a.expire_rise {
	background-position: -61px -134px;
}

.expire a.expire_null {
	background-position: -61px -15px;
	padding-right: 0px;
}

#ajaxSerieslist a {
	text-decoration: none;
}

#ajaxSerieslist a:hover {
	text-decoration: underline;
}

#ajaxSerieslist td {
	border: 1px solid #ddd;
	text-align: center;
	padding: 4px;
}

#thead tr th {
	border: 1px solid #ddd;
	text-align: center;
}


</style>

<script type="text/javascript">
	$(document).ready(function() {
		_queryList("");
	});
	//处理查询条件的默认值
    //参数：id;ovalue原值;nvalue 新值; type：事件类型（1表示获取焦点 2表示失去焦点）
    function clearDefaultVal(id,type,ovalue,nvalue){
        if(type==1){//判断事件类型(获取焦点,情况现有默认值)
            jQuery("#"+id).val("");
        }else{
            //失去焦点，值为空，赋默认值
            if(nvalue==""){
                jQuery("#"+id).val(ovalue);
            }
        }
    }
    function toView(id){
    	window.location.href ="<%=path%>/productPublish/toProductPublishInfoPage.do?pageFlag=info&productId="+id;
    }

    function _subAudit(id,name,status){
    	var url = "<%=path%>/productPrice/modifyPrice.do?productId="+id+"&status="+status;
    	parent.layer.open({
  			title: ' ',
  			type: 2, 
  			area: ['750px', '450px'],
  			content: [url,'no'], //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: [url, 'no']
			end: function(index, layero){ 
  				_queryList();
  				return false; 
			}    
		});
    }
    
    var pagination;
	function _queryList(){
		var title = $("#queryTitle").val();
		if(title =="请输入商品标题..."){
			title = "";
		}	
		var frmStartTime = $("#frmStartTime").val();
	    var frmEndTime = $("#frmEndTime").val();
	    if(frmStartTime>frmEndTime){
		    if(frmEndTime !=null&&frmEndTime !=""&&frmEndTime !="undefined"){
		    	parent.swal("开始时间不可以大于结束时间!");
		    	return;
		    }
		}
		var status = $("#selStatus").val();	
		var url = "<%=path %>/productPrice/productPriceAuditList.do?productName="+title+"&status="+status+"&flag=apply&frmStartTime="+frmStartTime+"&frmEndTime="+frmEndTime;
  			pagination = _initPagination({'pageId':'pagination', 'cKey':'toProductForSaleList','url': url, 'rows': 6, 'callback':_initDataList});
	}
	function _initDataList(data) {
	 		var d = data.rows;
	 		var total = data.total;
			var str = "";
			$("#ajaxSerieslist").empty();
			for(var i=0;i<d.length;i++){
				
				str += "<tr>";
				/* str += "    <td class='t1' style='text-align:center;vertical-align: middle'>";
				if(d[i].STATUS == '1'){
					str += " 		<input type='checkbox' name='productId' status='"+d[i].STATUS+"' value='"+d[i].PRODUCT_ID+"' star='3' mainpro=''>";
				}else{
					str += " 		<input type='checkbox' disabled='disabled' name='productId' status='"+d[i].STATUS+"' value='"+d[i].PRODUCT_ID+"' star='3' mainpro=''>";
				}
				str += "    </td>"; */
				str += "    <td class='t2' style='text-align:center;vertical-align: middle'>";
				str += "    		<a href='javascript:toView(\""+d[i].PRODUCT_ID+"\")' target='_blank'>";
				if(d[i].PRODUCT_PIC==undefined){
					str += "        		<img src='<%=path%>/download/error/nopicture.jpg'  alt='' resizeimg='true' onmousedown='' onerror='javascript:this.src=\"<%=path%>/download/error/nopicture.jpg\";' style='width: 50px; height: 43.5px;'>";
				} else {
					str += "        		<img src='"+d[i].PRODUCT_PIC+"'  alt='' resizeimg='true' onmousedown='' onerror='javascript:this.src=\"<%=path%>/download/error/nopicture.jpg\";' style='width: 50px; height: 43.5px;'>";
				}
				str += "    		</a>";
				str += "	</td>";
				str += " 	<td class='t3' style='text-align:left;vertical-align: middle'>";
				str += "		<p>";
				str += ""+ d[i].PRODUCT_NAME;
				str +="			</p>";
				str +=" 	</td>";
				if(d[i].PRODUCT_COST!=undefined){
					str +="		<td class='' style='text-align:right;vertical-align: middle'>"+d[i].PRODUCT_COST+"元&nbsp;";
				}else{
					str +="		<td class='' style='text-align:right;vertical-align: middle'>未定义价格&nbsp;";
				}
				str +="		</td>";
				str += " 	<td class='' style='text-align:center;vertical-align: middle'>";
				str += ""+ d[i].CREATE_TIME;
				str +=" 	</td>";
				str +=" 	<td class='' style='text-align:center;vertical-align: middle'>";
				
				var opeTitle = '';
				if(d[i].STATUS == '0'){
					str +="             &nbsp;草稿";
					opeTitle = "提交";
				}
				if(d[i].STATUS == '1'){
					str +="             &nbsp;待审核";
					opeTitle = "详情";
				}	
				if(d[i].STATUS == '2'){
					str +="             &nbsp;已通过";
					opeTitle = "详情";
				}	
				if(d[i].STATUS == '3'){
					str +="             &nbsp;未通过";
					opeTitle = "更改提交";
				}					
				str +=" 	</td>";
				str += " 	<td class='' style='text-align:center;vertical-align: middle'>";
				if(d[i].STATUS == "1"||d[i].STATUS == "2"){
					str +="             <a href='javascript:_auditPassed(\""+ d[i].PRODUCT_ID +"\",\""+ d[i].UUID +"\",\""+ d[i].STATUS +"\")' >"+opeTitle+"</a>";
				}else if(d[i].STATUS == "0"||d[i].STATUS == "3"){
					str +="             <a href='javascript:_subAudit(\""+ d[i].PRODUCT_ID +"\",\""+ d[i].PRODUCT_NAME +"\",\""+ d[i].STATUS +"\")' >"+opeTitle+"</a>";
				} 
				str +=" 	</td>";	                
				str +=" </tr>";
			}
			$("#ajaxSerieslist").append(str);
			setTimeout(function(){_reHeight("rightFrame","contentDiv");},1000);
	 }
	function _auditPassed(id,uuid,status){
    	window.location.href ="<%=path%>/productPrice/auditPrice.do?productId="+id+"&passed=1&uuid="+uuid+"&status="+status+"&appFlag=apply";
    }
</script>
</head>

<body style="font-family: '微软雅黑'">
	<div id="contentDiv" style="padding:4px; width:99%;">
		<div class="colnums-2-ab-b" style="overflow-x:auto;">
			<div class="toptil">变价申请</div>
			<div class="search_lis"
				style="border: 1px solid #e0e0e0;background: #f5f5f5;padding-left:10px;margin-bottom:10px;width:98.5%;padding-bottom: 9px;">
				<!--search_lis S-->
				<div class="search_lis_se" style="font-size: 14px;">
					<!--search_lis_se S-->
					<span>商品标题:</span><input name="querytitle" id="queryTitle"
						type="text" class="in_bit" maxlength="40" style="height: 24px;" value="请输入商品标题..."
						defaultval="请输入商品标题..."
						onblur="clearDefaultVal('queryTitle',2,'请输入商品标题...',this.value)"
						onfocus="clearDefaultVal('queryTitle',1,'','')">
					<span>申请时间:</span>
						<input type="text" id="frmStartTime" name="frmStartTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'#F{$dp.$D(\'frmEndTime\')}'})" style="width: 110px;height: 24px; padding-left: 3px" onfocus="WdatePicker({position:{left:320,top:88}})" class="Wdate" value="" realvalue="">
						<span style="margin: 0px 5px;">至</span>
						<input type="text" id="frmEndTime" name="frmEndTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'frmStartTime\')}'})" style="width: 110px;height: 24px; padding-left: 3px;margin-right: 2px;" onfocus="WdatePicker({position:{left:468,top:88}})" class="Wdate" value="" realvalue="">
						<span>&nbsp;审核状态:</span>
						<select id="selStatus" class="in_bit" style="width:110px;height:25px;">
							<option value="">请选择</option>
							<option value="0">草稿</option>
							<option value="1">待审核</option>
							<option value="2">已通过</option>
							<option value="3">未通过</option>
						</select>
					
					<button type="button" class="cxx_btn" onclick="_queryList('')">查询</button>
				</div>
				<div class="wantBuy" id="caigouInfo"></div>
			</div>


			<div class="listed_tb_k" style="width:99.65%;border: none;">
				<!-- 销售中商品  重发、永久删除、转为过期等功能在列表顶部显示  2014-10-23 0发版 moxiaoyang-->
				<table cellspacing="0" cellpadding="0">
					<thead id="thead">
						<tr>
							<th class="t2" style="text-align:center;vertical-align: middle">图片</th>
							<th class="t3" style="text-align:center;vertical-align: middle">标题</th>
							<th class="" style="text-align:center;vertical-align: middle;width:12%;">价格</th>
							<th class="" style="text-align:center;vertical-align: middle;width:15%;">申请时间</th>
							<th class="" style="text-align:center;vertical-align: middle;width:12%;">状态</th>
							<!--实时计算新增列结束-->
							<th class=""	style="text-align:center;vertical-align: middle;width:12%;">操作</th>
						</tr>
					</thead>
					<tbody id="ajaxSerieslist">
					</tbody>
				</table>
				<div id="pagination"></div>
			</div>

			<!-- InstanceEndEditable -->
		</div>
		<!--colnums-2-ab-b begin-->
		<div class="clear"></div>

		<div id="dialogDiv"
			style="text-align: center;padding-top:24px;display:none;">
			<label>帐号:</label><input type="text" id="user" /><br> <label>密码:</label><input
				type="password" id="password" /><br>
		</div>

	</div>

</body>

<script type="text/javascript">
	$(document).ready(function() {
		_reHeight("rightFrame", "contentDiv");
	});
</script>
</html>
